
const File = require('../plugins/file.plugin');

module.exports = {
    fileDownloadFile: File.downloadFile,
    fileSaveFile: File.saveFile,
    fileOpenDocument: File.openDocument,
    fileToBase64 (filePath) {
        return new Promise((resolve, reject) => {
            wx.getFileSystemManager().readFile({
                filePath, //选择图片返回的相对路径
                encoding: 'base64', //编码格式
                success:(res) =>{
                    resolve(res.data);
                    // let baseImg = 'data:image/png;base64,' + res.data
                    // that.data.baseImg = baseImg
                },
                fail: reject
            })
        })
    },
    fileBase64src: File.base64src,
    fileCanvasToFile: File.canvasToTempFilePath,
};
